
<div class="container member-container">
    <?php include $this->getViewFile('../lib/leftmenu'); ?>
    <div class="col-md-10 member-con menber-score-con">
        <div class="title mb-common-title">兑换商品记录</div>
        <!-- 搜索 -->
        <div style="padding-left:20px">
        <?php $objForm = $this->beginWidget( 'CActiveForm', array('id' => 'SubmitForm', 'method' => 'get', 'action' => $this->createUrl('record'))); ?>
        是否确定：<?php echo $objForm->dropDownList($model,'is_sure',RedeemRecordsModel::getSureHtmlList(),array('empty' => '全部')); ?>&nbsp;&nbsp;&nbsp;&nbsp;
        是否返款：<?php echo $objForm->dropDownList($model,'is_refund',RedeemRecordsModel::getRefundHtmlList(),array('empty' => '全部')); ?>&nbsp;&nbsp;&nbsp;&nbsp;
        是否提交订单：<?php echo Form::select(array(1=>'是',2=>'否'),$is_order_sn,'name="is_order_sn"','全部') ?>&nbsp;&nbsp;&nbsp;&nbsp;
        订单提交时间：
            <?php $this->widget( 'zii.widgets.jui.CJuiDatePicker', array(
                //'model' => $model,
                'language'=>'zh-CN',
                'name' => 'start_time',
                'value' => $start_time,
                'options' => array(
                  'dateFormat' => 'yy-mm-dd',
                  'changeYear' => true,
                  'changeMonth' => true,
                ),
                'htmlOptions' => array(
                  'id' => 'start_time',
                  'readonly' => 'readonly',
                  'placeholder' =>'选择超始时间',
                  'style' => 'width:100px',
                ),
              ));
            ?>
        -
            <?php $this->widget( 'zii.widgets.jui.CJuiDatePicker', array(
                'language'=>'zh-CN',
                'name' => 'end_time',
                'value' => $end_time,
                'options' => array(
                  'dateFormat' => 'yy-mm-dd',
                  'changeYear' => true,
                  'changeMonth' => true,
                ),
                'htmlOptions' => array(
                  'id' => 'end_time',
                  'readonly' => 'readonly',
                  'placeholder' =>'选择结束时间',
                  'style' => 'width:100px',
                ),
              ));
            ?>        

        <button class="btn">搜索</button>
            <?php $this->endWidget(); ?>
        </div>
        <div class="content">
            <table width="885">
                <thead>
                  <tr>
                    <td align="center">兑换商品</td>
                    <td align="center" width="100">兑换积分</td>
                    <td align="center" width="100">订单号</td>
                    <td align="center" width="200"><?php echo $sort->link( 'record_time' ) ?></td>
                    <td align="center" width="">是否确定</td>
                    <td align="center" width="">是否返款</td>
                    <td align="center" width="">操作</td>
                  </tr>
                </thead>
                <tbody>
                    <?php
                    foreach($models as $rs){
                    ?>
                    <tr>
                        <td align="center"><a href="<?php echo yii::app()->createUrl('/front/good/redeemskip', array('gid' => $rs->RedeemModel->id)) ?>" target="_blank"><img width="100px" height="100px" src="<?php echo $rs->RedeemModel->thumb?>" /></a></td>
                        <td align="center" width="100"><?php echo $rs->integral?></td>
                        <td align="center" width="100"><?php echo $rs->order_sn?></td>
                                                
                        <td align="center" width="100"><?php echo date('Y-m-d H:i:s',$rs->record_time) ?></td>
                        <td class="is_sure" align="center" width="100"><?php echo RedeemRecordsModel::getSureHtmlDetail($rs->is_sure) ?></td>
                        <td align="center" width="100"><?php echo RedeemRecordsModel::getRefundHtmlDetail($rs->is_refund) ?></td>

                        <td align="center" width="100">
                            <?php 
                            if($rs->is_sure == RedeemRecordsModel::SURE_NOT && $rs->order_sn != '')
                            {
                                echo "<span style='cursor:pointer' data-id='{$rs->id}' class='sure' >确定</span>";
                            }
                             ?>
                        </td>
                    </tr>
                    <?php
                    }
                    ?>
                    <tr>
                            <td colspan="7" class="pager">
                                <?php
                                $this->widget('CLinkPager', array(
                                    'header' => "",
                                    'firstPageLabel' => '首页',
                                    'lastPageLabel' => '末页',
                                    'prevPageLabel' => '上一页',
                                    'nextPageLabel' => '下一页',
                                    'pages' => $pages,
                                    'footer' => "<span>共<em>{$pages->pageCount}</em>页</span>",
                                    'maxButtonCount' => 5
                                        )
                                );
                                ?>
                            </td>
                        </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div class="clearfix"></div>
</div>


<link rel="stylesheet" href="<?php echo Yii::app()->params->staticUrl; ?>statics/js/artDialog6/css/ui-dialog.css">
<script src="<?php echo Yii::app()->params->staticUrl; ?>statics/js/artDialog6/js/dialog-min.js"></script>
<script type="text/javascript">
    $(".sure").click(function()
    {
        var obj = $(this);
        var id = $(this).data('id');
        if(id > 0)
        {
            var data = {id:id};
        }else
        {
            alert('找不到此记录');
            return false;
        }

        $.post('<?php echo YzwController::U("sure") ?>',data,function(rs){
            if(rs.status){
                alert(rs.info);
                obj.parent().prevAll('.is_sure').html('已确定');                
                obj.remove();                
                return;
            }else{
                 dialog({
                    fixed: true,
                    title: '提示信息',
                    content: rs.info,
                    time:1,
                    cancelDisplay: false
                }).show();
            }
        },'json');

    })
</script>